<?php
/**
 * ===============================================
 * 版权所有 2019-2050 青岛铁锤科技有限公司，并保留所有权利。
 * 网站地址: http://www.huaxianling.com
 * ===============================================
 * Author: Happy dong
 * Created Time: 2019-11-20 16:43
 *
 * Version: 2.0
 */

namespace App\Modules\MemberCard\Criterias;


use Flower\Core\Repository\Contracts\RepositoryInterface;
use Flower\Core\Repository\Criterias\BaseCriterias;

class GetOrderDetailBillListByOrderIdsCriteria extends BaseCriterias
{
	protected $orderIds;

	public function __construct($orderIds)
	{
		$this->orderIds = $orderIds;
	}

	/**
	 * @param $model
	 * @param RepositoryInterface $repository
	 * @return mixed
	 */
	public function apply($model, RepositoryInterface $repository)
	{
		$newModel = is_array($this->orderIds) ? $model->whereIn('id', $this->orderIds) : $model->where('id', $this->orderIds);
		return $newModel->orderBy('id', 'desc');
	}
}